package com.sum.common.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class TagInfo implements Serializable,Comparable<TagInfo>  {
    private Long index;
    private String type;
    private String epc;
    private int count;
    private String tid;
    private int rssi;
    private String userData;
    private String reservedData;
    private String nmv2d;
    private String epcData;
    private Integer ltu27;
    private Integer ltu31;
    private String moisture;
    private int ctesius;
    private boolean isShowTid ;
    private String memId;

    private int serialNumber;

    public TagInfo() {
    }

    public TagInfo(String epc, int count, int rssi) {
        this.epc = epc;
        this.count = count;
        this.rssi = rssi;
    }

    public TagInfo(String epc, int count, int rssi,String tid,int serialNumber) {
        this.epc = epc;
        this.count = count;
        this.rssi = rssi;
        this.tid = tid;
        this.serialNumber = serialNumber;
    }

    public String getMemId() {
        return memId;
    }

    public void setMemId(String memId) {
        this.memId = memId;
    }

    public int getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(int serialNumber) {
        this.serialNumber = serialNumber;
    }

    public Long getIndex() {
        return index;
    }

    public void setIndex(Long index) {
        this.index = index;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getEpc() {
        return epc;
    }

    public void setEpc(String epc) {
        this.epc = epc;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public int getRssi() {
        return rssi;
    }

    public void setRssi(int rssi) {
        this.rssi = rssi;
    }

    public String getUserData() {
        return userData;
    }

    public void setUserData(String userData) {
        this.userData = userData;
    }

    public String getReservedData() {
        return reservedData;
    }

    public void setReservedData(String reservedData) {
        this.reservedData = reservedData;
    }

    public String getNmv2d() {
        return nmv2d;
    }

    public void setNmv2d(String nmv2d) {
        this.nmv2d = nmv2d;
    }

    public String getEpcData() {
        return epcData;
    }

    public void setEpcData(String epcData) {
        this.epcData = epcData;
    }

    public Integer getLtu27() {
        return ltu27;
    }

    public void setLtu27(Integer ltu27) {
        this.ltu27 = ltu27;
    }

    public Integer getLtu31() {
        return ltu31;
    }

    public void setLtu31(Integer ltu31) {
        this.ltu31 = ltu31;
    }

    public String getMoisture() {
        return moisture;
    }

    public void setMoisture(String moisture) {
        this.moisture = moisture;
    }

    public int getCtesius() {
        return ctesius;
    }

    public void setCtesius(int ctesius) {
        this.ctesius = ctesius;
    }

    public boolean getIsShowTid() {
        return isShowTid;
    }

    public void setIsShowTid(boolean isShowTid) {
        this.isShowTid = isShowTid;
    }


    // 转换为Map的方法
    public Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("serialNumber", serialNumber);
        map.put("epcId", epc);
        map.put("tid", tid);
        map.put("count", count);
        map.put("rssi", rssi);
        return map;
    }

    // 添加equals和hashCode方法用于比较
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TagInfo tagInfo = (TagInfo) o;
        return epc.equals(tagInfo.epc);
    }

    @Override
    public int hashCode() {
        return Objects.hash(epc);
    }

    @Override
    public String toString() {
        return "TagInfo{" +
                "index=" + index +
                ", type='" + type + '\'' +
                ", epc='" + epc + '\'' +
                ", count=" + count +
                ", tid='" + tid + '\'' +
                ", rssi='" + rssi + '\'' +
                ", userData='" + userData + '\'' +
                ", reservedData='" + reservedData + '\'' +
                '}';
    }

    @Override
    public int compareTo(TagInfo other) {
        return Integer.compare(this.getSerialNumber(), other.getSerialNumber());
    }
}